package plantshop.controller.moves;

import java.io.Serializable;

import plantshop.model.Creature;
import plantshop.model.Game;
import plantshop.model.plants.Plant;

public class PlantBuyMove extends PlayerMove implements Serializable{
	private static final long serialVersionUID = 1581760826216845482L;
	private int disp, loc;
	private Plant p;
	
	
	public PlantBuyMove(int disp, int loc, Plant p){
		this.disp = disp;
		this.loc = loc;
		this.p = p;
	}
	
	@Override
	public void execute(Game game) {
		if(game.getStore().getMoney() >= p.getSeedPrice()){
			if(p.getName() == "Common Milkweed"){
				game.createCreature(new Creature(1));
			}
			if(p.getName() == "Aster"){
				game.createCreature(new Creature(1));
			}
			if(p.getName() == "Eastern Red Cedar"){
				game.createCreature(new Creature(2));
			}
			
			game.buyPlant(disp, loc, p);}
	}
	
}
